namespace DotNetNuke.Modules.Admin.ResourceInstaller
{
    using DotNetNuke.Services.Exceptions;
    using DotNetNuke.Services.Scheduling;
    using Microsoft.VisualBasic.CompilerServices;
    using System;

    public class InstallResources : SchedulerClient
    {
        public InstallResources(ScheduleHistoryItem objScheduleHistoryItem)
        {
            this.ScheduleHistoryItem = objScheduleHistoryItem;
        }

        public override void DoWork()
        {
            try
            {
                this.Progressing();
                new DotNetNuke.Modules.Admin.ResourceInstaller.ResourceInstaller().Install();
                this.ScheduleHistoryItem.Succeeded = true;
                this.ScheduleHistoryItem.AddLogNote("Resource Installation Complete.");
            }
            catch (Exception exception1)
            {
                
                Exception exc = exception1;
                this.ScheduleHistoryItem.Succeeded = false;
                this.ScheduleHistoryItem.AddLogNote("Resource Installation Failed. " + exc.ToString());
                this.Errored(ref exc);
                DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
                
            }
        }
    }
}

